<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
	<title>湖南省自来水公司营销管理信息系统</title> 
	
	<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/text.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/form.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/buttons.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/grid.css" type="text/css" media="screen" title="no title" />	
	<link rel="stylesheet" href="../css/layout.css" type="text/css" media="screen" title="no title" />	
	
	<link rel="stylesheet" href="../css/ui-darkness/jquery-ui-1.8.12.custom.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/jquery.visualize.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/facebox.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/uniform.default.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/dataTables.css" type="text/css" media="screen" title="no title" />

	<link rel="stylesheet" href="../css/custom.css" type="text/css" media="screen" title="no title">
	<script src="../js/jquery/jquery-3.3.1.js"></script>

</head> 
 
<body> 

<div id="wrapper">

<div id="bool"></div>

	
	<div id="content" class="xgrid">
		
 		
		<div class="x12">
			
			<h2>发票入库</h2>
			
			<div class="form label-inline uniform">

				<div class="field"><label for="InDate">入库时间</label> <input id="InDate" name="InDate" size="50" type="text" class="medium" disabled="disabled" /></div>
				
				<div class="field"><label for="InEmpID">入库人员</label>
					<input id="InEmpID" name="lname" size="50" type="hidden" class="medium" disabled="disabled" v-model="IvInInvoice.InEmpID" />
					<input type="text" id="empname" disabled="disabled">
				</div>
				
				<div class="field"><label for="InvoiceType">发票类型</label>
                    <select id="InvoiceType" class="medium" v-model="IvInInvoice.InvoiceType">
						<option value="0">普通发票</option>
						<option value="1">增值税发票</option>
					</select></div>

                <script>
                    function fp() {
                        var StartNo=$("#StartNo").val();
                        var EndNo=$("#EndNo").val();
                        var kool=EndNo-StartNo+1;
                        if(kool<=1){
                            swal(
                                '终止号码必须大于初始号码!',
                                'warning!',
                                'warning'
                            )
                            kool=null;
                        }
                        $("#InCounts").val(kool);
                        content.IvInInvoice.InCounts=kool;
                    }
                </script>
				
				<div class="field"><label for="StartNo">发票起始号码</label> <input id="StartNo" name="lname" size="50" type="text" class="medium" v-model="IvInInvoice.StartNo" @change="queryStarNo()"  /></div>
				
				<div class="field"><label for="EndNo">发票终止号码</label> <input id="EndNo" onchange="fp()" name="lname" size="50" type="text" class="medium" v-model="IvInInvoice.EndNo" /></div>
				
				<div class="field"><label for="InCounts">发票张数</label> <input id="InCounts" name="lname" size="50" type="text" class="medium" disabled="disabled" placeholder="填入发票号码后，动态显示" v-model="IvInInvoice.InCounts" /></div>

				<div class="buttonrow">
					<button class="btn" @click="add()" type="submit">保存</button>
					<button class="btn btn-grey" onClick="history.back(-1);">返回</button>
				</div>

			</div>
			
		</div> <!-- .x12 -->
		
	</div> <!-- #content -->

	
</div> <!-- #wrapper -->

<script src="../js/jquery/jquery-1.5.2.min.js"></script>
<script src="../js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="../js/misc/excanvas.min.js"></script>
<script src="../js/jquery/facebox.js"></script>
<script src="../js/jquery/jquery.visualize.js"></script>
<script src="../js/jquery/jquery.dataTables.min.js"></script>
<script src="../js/jquery/jquery.tablesorter.min.js"></script>
<script src="../js/jquery/jquery.uniform.min.js"></script>
<script src="../js/jquery/jquery.placeholder.min.js"></script>

<script src="../js/widgets.js"></script>
<script src="../js/dashboard.js"></script>

<script src="../js/vue.js"></script>
<script src="https://cdn.bootcss.com/vue-resource/1.5.1/vue-resource.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

<!--<script>-->
     <!--$(document).ready ( function ()-->
 <!--{-->
 	<!--Dashboard.init ();-->
 <!--});-->

<!--</script>-->

<script>
    function tools() {
        var date= new Date();
        var time =date.getFullYear()+"-"+(date.getMonth()+1)+"-"+(date.getDay()+13)+"  "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()
        $("#InDate").val(time)
        //content.IvInInvoice.InDate=time;
    }
    window.onload=function(){
        window.setInterval(tools,500);

    }
</script>

<script>

    function ff() {
       $.post("/getInId",{},function (str) {
          // alert(str)
       })
    }


    var content=new Vue({
        el:"#wrapper",
        data:{
            ivs:'', //IvIninvoice集合
            IvInInvoice:{
                StartNo:'',
                EndNo:'',
                InCounts:'',
                InEmpID:'1',
                InvoiceType:'',
            }
        },
        methods:{
            queryStarNo(){
                var StartNo=$("#StartNo").val();
                $.post("/iv-in-StartNo",{"StartNo":StartNo},function (str) {

                    if(str==1){
                        swal(
                            '发票起始号码可用!',
                            'success!',
                            'success'
                        )
                    }else{
                        swal(
                            '发票起始号码已存在!',
                            'error!',
                            'error'
                        )
                    }
                })
            },
            add(){
                //alert(JSON.stringify(this.IvInInvoice));
                $.post("/iv-add/",this.IvInInvoice,function (str) {
                    if(str!=0){
                        swal(
                            '添加成功!',
                            'success!',
                            'success'
                        )
                        ff();
                        setTimeout("javascript:location.href='inv_invoiceManage.html'", 1000);
                    }else{
                        swal(
                            '添加失败!',
                            'error!',
                            'error'
                        )
                    }

                })
            },


        },
		created(){
			$(function(){
					$("#bool").load("../ming.html");
					setTimeout(function(){
						//alert(JSON.stringify(ming.Syemp))
						$("#empname").val(ming.Syemp.empNmae)
						$("#InEmpID").val(ming.Syemp.id)
					},100)
			})
		}
    });

</script>


</body> 
 
</html>



<!--<script type="text/javascript">-->
<!--function today(){//构建方法-->
<!--var today=new Date();//new 出当前时间-->
<!--var h=today.getFullYear();//获取年-->
<!--var m=today.getMonth()+1;//获取月-->
<!--var d=today.getDate();//获取日-->
<!--//return h+"-"+m+"-"+d; //返回 年-月-日 时:分:秒-->
<!--var time =h+"-"+m+"-"+d;-->
<!--//var time=date.getFullYear()+"-"+(date.getMonth()+1)+"-"+(date.getDay()-1)+"  "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()-->

<!--}-->
<!--//document.getElementById("InDate").value = today();//将获取到的 年-月-日 时:分:秒 赋给input文本输入框-->
<!--$("#InDate").val(time)-->
<!--content.iviv.InDate=time;-->

